package com.hsp.test1;

import java.util.ArrayList;
import java.util.Iterator;

public class Test {

	public static void main(String[] args) {
		ArrayList<Dog> list = new ArrayList<>();
		Dog dog1 = new Dog("hm", 12);
		Dog dog2 = new Dog("xn", 13);
		Dog dog3 = new Dog("a", 18);
		list.add(dog1);
		list.add(dog2);
		list.add(dog3);
		for (Object obj : list) {
			System.out.println(obj.toString());
		}
		Iterator<Dog> ite = list.iterator();
		while (ite.hasNext()) {
			String str = ite.next().toString();
			System.out.println(str);
		}

	}

}
